package com.xtx.air.web.commons;

import java.util.Map;

public class AjaxResult {

	private Integer resultCode;
	private String message;
	private Map resultMap;

	public final static Integer OK = 1;
	public final static Integer FAILURE = 0;

	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public Integer getResultCode() {
		return resultCode;
	}
	public void setResultCode(Integer resultCode) {
		this.resultCode = resultCode;
	}

	public boolean isOK(){
		if(this.resultCode.equals(AjaxResult.OK)){
			return true;
		}else{
			return false;
		}
	}

	public Map getResultMap() {
		return resultMap;
	}
	public void setResultMap(Map resultMap) {
		this.resultMap = resultMap;
	}

	public static AjaxResult succResult(){
		AjaxResult r = new AjaxResult();
		r.setResultCode(AjaxResult.OK);
		return r;
	}

	public static AjaxResult errorResult(String message){
		AjaxResult r = new AjaxResult();
		r.setResultCode(AjaxResult.FAILURE);
		r.setMessage(message);
		return r;
	}

	public static AjaxResult commonResult(String message){
		AjaxResult r = new AjaxResult();
		r.setResultCode(AjaxResult.OK);
		r.setMessage(message);
		return r;
	}
}
